Xbasic

*HTML_TO_BIN Function

Syntax

RTF_Binary_Text as B = *HTML_TO_BIN(C text)

Arguments

RTF_Binary_Text

Binary formatted RTF text as it exists in a RTF memo field.

text

Encoded HTML text

Description

Convert from html to binary.

Discussion

The *HTML_TO_BIN() function converts HTML text to its equivalent binary RTF memo format.

Example

dim html_text as C
dim rtf_bin as B 
dim tbl as P 
 
html_text = file.to_string("c:\rtf_test.htm") 
html_text = extract_string(html_text,"<body", "</body>") 
html_text = right(html_text, len(html_text)-1)
 
? html_text 
= <font face="Verdana, Arial, Helvetica, sans-serif"><strong><font color="#FF0000">George</font></strong> lived on top of a <font color="#0000FF"><em>mountain</em></font>. </font> 
 
rtf_bin = *html_to_bin(html_text) 
 
tbl = table.open("customer") 
tbl.fetch_first() 
tbl.change_begin(.t.) 
tbl.Rtfmemo = rtf_bin 
tbl.change_end(.t.) 
tbl.close()

See Also